home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2002 #11 / Amiga Plus CD - 2002 - No. 11.iso / amigaoscd / amigapluscd / AP-Website / forum / wbboard / edit.php < prev    next >
Text File  |  2002-03-15  |  6KB  |  111 lines

  1. <? 
  2. require("_functions.php");
  3. require("_header.php");
  4. require("_board_jump.php");
  5.  
  6. $post = $db_zugriff->query_first("SELECT boardparentid, threadparentid, userid, message, disable_smilies FROM bb".$n."_posts WHERE postid='$postid'");
  7.  
  8. if($boardid != $post[boardparentid] || $threadid != $post[threadparentid]) { 
  9.     eval("dooutput(\"".gettemplate("hack_error")."\");");
  10.     exit;
  11. }
  12. if(($userdata[ismod] && check_boardobject($boardid,$user_id,"mod")) || $userdata[issupermod] || ($post[userid] && $userdata[caneditownpost] && $user_id == $post[userid])) {
  13.     
  14.     if($action == "send" && !$preview) {
  15.         if(!$delete && (!$message || check_posts($message))) eval ("\$error = \"".gettemplate("newthread_error")."\";");
  16.         else {
  17.             if($delete && (($userdata[ismod] && check_boardobject($boardid,$user_id,"mod")) || $userdata[issupermod] || ($post[userid] && $userdata[candelownpost] && $user_id == $post[userid]))) {
  18.                         $result = delPost($postid,$threadid,$boardid);
  19.                         if($result==1) {
  20.                                    eval ("\$output = \"".gettemplate("note15")."\";");
  21.                                 $ride = "thread.php?boardid=$boardid&styleid=$styleid&threadid=$threadid$session";
  22.                         }
  23.                         if($result==2) {
  24.                                 eval ("\$output = \"".gettemplate("note16")."\";");
  25.                                    $ride = "board.php?boardid=$boardid&styleid=$styleid$session";
  26.                         }
  27.                 }
  28.                 else {
  29.                         $thread_info = $db_zugriff->query_first("SELECT flags FROM bb".$n."_threads WHERE threadid='$threadid'");
  30.                     if($thread_info[flags]) eval ("\$output = \"".gettemplate("note17")."\";");
  31.                         else {
  32.                                 if($appendnote) {
  33.                                     $time = time();
  34.                                     $editorid = $user_id;
  35.                                 }
  36.                                 $message = editPostdata($message);
  37.                                     if($parseurl) $message = parseURL($message);
  38.                                     $db_zugriff->query("UPDATE bb".$n."_posts SET edittime='$time', editorid = '$editorid', message='$message', disable_smilies='$disablesmilies' WHERE postid='$postid'");
  39.                                 if($appendnote) $db_zugriff->query("UPDATE bb".$n."_threads SET timelastreply='$time' WHERE threadid='$threadid'");
  40.                                 eval ("\$output = \"".gettemplate("note8")."\";");
  41.                             }
  42.                     }
  43.                 
  44.                 if(!$ride) {
  45.                 
  46.                         $post_result = $db_zugriff->query("SELECT postid FROM bb".$n."_posts WHERE threadparentid='$post[threadparentid]' ORDER by posttime ".ifelse($postorder,"DESC","ASC"));
  47.                         $i=1;
  48.                         while($row = $db_zugriff->fetch_array($post_result)) {
  49.                             if($postid == $row[postid]) break;
  50.                             $i++;
  51.                         }
  52.                         $db_zugriff->free_result($post_result);
  53.                         $pages=(int)($i/$eproseite);
  54.                         if(($i/$eproseite)-$pages>0) $pages++;
  55.  
  56.                         $ride = "thread.php?threadid=$post[threadparentid]&boardid=$post[boardparentid]&styleid=$styleid$session&page=".$pages."#".$i;
  57.                        }
  58.                 
  59.                 header("Location: $ride");
  60.             exit;
  61.         }
  62.     }
  63.  
  64.     if($preview || $error) {
  65.         if($user_id) {
  66.             $user_info = $db_zugriff->query_first("SELECT signatur FROM bb".$n."_user_table WHERE userid='$user_id'");
  67.                     if($user_info[signatur] && $signature && !$hide_signature) {
  68.                               $signatur = editSignatur($user_info[signatur],$disablesmilies);
  69.                 eval ("\$pre_signature = \"".gettemplate("thread_signature")."\";");
  70.             }
  71.         }
  72.                 if($posticon) $pre_posticon = "<img src=\"".$posticon."\">";
  73.                 else $pre_posticon = " ";
  74.                 $post = editPost($message,$disablesmilies);
  75.                 if($preview) eval ("\$preview = \"".gettemplate("preview")."\";");
  76.                         
  77.                 if($parseurl) $checked[0] = "CHECKED";
  78.         else $checked[0] = "";
  79.         if($disablesmilies) $checked[1] = "CHECKED";
  80.         else $checked[1] = "";
  81.         if($delete) $checked[2] = "CHECKED";
  82.         else $checked[2] = "";
  83.         if($appendnote) $checked[3] = "CHECKED";
  84.         else $checked[3] = "";
  85.     }
  86.     else {
  87.         if($ch_parseurl) $checked[0] = "CHECKED";
  88.         if($post[disable_smilies]) $checked[1] = "CHECKED"; 
  89.     }
  90.     
  91.     if($bbcode && $u_bbcode) $bbcode_buttons = getcodebuttons();
  92.     if($smilies && $u_bbcode) $bbcode_smilies = getclickysmilies(3,$anzahl_smilies);
  93.  
  94.     if($html) eval ("\$note .= \"".gettemplate("newthread_html_enable")."\";");
  95.     else eval ("\$note .= \"".gettemplate("newthread_html_disable")."\";");
  96.     if(!$smilies) eval ("\$note .= \"".gettemplate("newthread_smilies_disable")."\";");
  97.     if(!$bbcode) eval ("\$note .= \"".gettemplate("newthread_bbcode_disable")."\";");
  98.  
  99.     $navi_chain = makenavichain("edit",$boardid,$threadid);
  100.     if(!$preview) $edit = editDBdata($post[message]);
  101.     else $edit = stripslashes($message);
  102.     
  103.     if(($userdata[ismod] && check_boardobject($boardid,$user_id,"mod")) || $userdata[issupermod] || ($post[userid] && $userdata[candelownpost] && $user_id == $post[userid])) eval ("\$edit_del = \"".gettemplate("edit_del")."\";");
  104.     if(!$userdata[appendeditnote]) eval ("\$edit_appendnote = \"".gettemplate("edit_appendnote")."\";");
  105.     else $edit_appendnote = "<input type=\"hidden\" value=\"1\" name=\"appendnote\">";
  106.     $edit=htmlspecialchars($edit);
  107.     eval("dooutput(\"".gettemplate("edit")."\");");
  108. }
  109. else header("LOCATION: misc.php?action=access_error&boardid=$boardid&styleid=$styleid$session");
  110. ?>
  111.